import { get, post, put } from './request.js';
import { storage } from '@/utils'

export const getManufacturerCompnays = params => get('api/wx/company-customer/list', params);
export const getManufacturerCustomerProjects = params => get('api/wx/project/customer-project-list', params);
export const getManufacturerCustomerProjectDevices = params => get('api/wx/device/customer/project/list', params);
export const getCustomerDevices = params => get('api/wx/device/customer/list', params);
export const getManufacturerCustomerEngineers = () => get('api/wx/company/employee/ability-order-users', {});
export const createProblem = data => post('api/wx/problem/create', data);
export const updateProblem = data => post('api/wx/problem/update', data);
export const getCustomerReatDevice = id => get('api/v2/customerReatDevice/getById/' + id, {});
export const getOpenId = data => post('mp/getOpenid', data);
export const getUserMobile = data => post('mp/getUserMobile', data);
export const getUserByAccount = mobile => get('api/wx/user/getByAccount/' + mobile, {});
export const getSmsCode = mobile => get('api/login/get_sms_code/' + mobile, {});
export const activeAccount = data => post('api/wx/account/active', data);
export const getLoadPage = manufacturerId => get(`api/ll/get_load_page/${manufacturerId}`, {});
export const loginByOpenId = data => post('api/login/openId/auto/' + data.loginType, data);
export const getUserPerms = () => get('api/perm/get_user_perms', {});
export const userLogout = type => put('api/my/center/out/' + type, {});
export const getProjectById = id => get('api/wx/project/get_detail/' + id, {});
export const companyUserRegister = data => post('api/wx/customerUser/add', data);
export const isCustomizationCustomer = params => get('api/wx/company/customization', params);
export const getAddressDetail = data => post('api/wx/location/', data);
export const getCustomerPageDevices = params => get('api/wx/device/customer/page', params);
export const generateVideo = data => post('api/wx/knowledge/script/generate', data);
export const getDeviceCategory = params => get('api/v2/device/getDeviceCategories', params);
export const knowledgePublish = data => post('api/wx/knowledge/script/to-library', data);
export const getVideoDraft = id => post('mp/videoDraft/query/' + id, {});
export const getVideoDraftStep = id => post('mp/videoStep/query/' + id, {});
export const getUploadSinature = data => post('api/wx/oss/generatePostPolicy', data);
export const getEmployeeProblemList = data => post('api/wx/getEmployeeProblemList', data);
export const getManagerProblemList = data => post('api/wx/getManagerProblemList', data);
export const getCompanyProblemCount = () => get(`api/problem/statisticsByState/manager/${storage.get('deptId')}/all`, {});
export const getManagerProblemCount = () => get(`api/problem/statisticsByState/manager/${storage.get('deptId')}/my`, {});
export const getEmployeeProblemCount = () => get(`api/problem/statisticsByState/employee/${storage.get('deptId')}`, {});
export const passOrder = ({ pid, receiveCompanyId, receiveUserId, sendCompanyId, sendUserId }) =>
	put(`api/wx/workorderflow/audit_ok/${pid}/${receiveCompanyId}/${receiveUserId}/${sendCompanyId}/${sendUserId}`, {});
export const rejectOrder = ({ pid, receiveCompanyId, receiveUserId, sendCompanyId, sendUserId, cause }) =>
	put(`api/wx/workorderflow/audit_reject/${pid}/${receiveCompanyId}/${receiveUserId}/${sendCompanyId}/${sendUserId}/${cause}`, {});
export const getUserCanTakeService = ({ companyId, customerId }) => get(`api/getUserCanTakeService/${companyId}/${customerId}`, {});
export const assignOrder = data => post('api/wx/workorderflow/reassign', data);
export const applyReassignOrder = data => post('api/wx/problem/applyReAssign', data);
export const acceptOrder = ({ pid, receiveCompanyId, receiveUserId, sendCompanyId, sendUserId, beginTime, gmtPlanEnd }) =>
	put(
		`api/wx/workorderflow/reassign_ok/${pid}/${receiveCompanyId}/${receiveUserId}/${sendCompanyId}/${sendUserId}/${beginTime}/${gmtPlanEnd}`,
		{}
	);
export const getApplyReAssign = id => get('api/wx/problem/getApplyReAssign/' + id, {});
export const handleReassignApply = ({ type, id }) => put(`api/wx/problem/${type}/${id}`, {});
export const signIn = data => post('api/serviceLog/clockIn', data);
export const saveOrderServiceLog = data => post('api/serviceLog/save', data);
export const getEmployeeRank = params => get(`api/wx/employee/score/statistics/${params.name}`, params);
export const saveProblemComment = data => post('api/problemComment/add', data);
export const getProblemDetail = workOrderId => get(`api/workorder/detail/${workOrderId}`, {});
export const closeProblem = data => post(`api/problem/closeProblem`, data);
export const getServiceLog = params => get(`api/serviceLog/query/${params.reponser}/${params.pId}`, {});
export const getProblemTalkList = data => post(`api/getProblemTalkList/wx`, data);
export const getProjectByCustomer = params => get(`api/project/projectByCustomer`, params);
export const getDeviceCategoryByParentId = params => get(`api/wx/device-category/query`, params);
export const getDeviceCategoryTree = params => get(`api/wx/device-category/tree`, params);
export const updateProblemNew = data => post(`api/wx/work-order/update`, data);
export const getManufacturerListHeader = (params) => get('api/wx/work-order/manufacturer/list-header', params, { loading: false });
export const getManufacturerProblemList = data => post(`api/wx/work-order/manufacturer/list`, data);
export const getCompanyProblemList = data => post(`api/wx/work-order/company/list`, data);
export const getProblemComment = problemId => get('api/problemComment/getByPId/' + problemId, {});
export const companyLogin = data => post(`api/wx/company/login`, data);
export const getAdList = () => get('api/wx/ad/recommend-list?manufacturerId=' + storage.get('manufacturerId') || -1, {});
export const adClick = adId => post('api/wx/ad/click?adId=' + adId, {});
export const getImUser = workOrderId => get('api/wx/im/user/list?workOrderId=' + workOrderId, {});
export const videoCall = workOrderId => post('api/wx/im/user/video-call-notice?workOrderId=' + workOrderId, {});
export const sendImMessage = data => post(`api/wx/im/message`, data);
export const getDeviceDetail = params => get(`api/wx/device/detail`, params);
export const getDictData = data => post(`api/wx/dict/sys/data/list`, data);
export const getDictDataList = data => post(`api/wx/dict/sys/data-by-type-list`, data);
export const getKnowledgeList = data => {
	data.manufacturerId = storage.get('manufacturerId');
	return post(`api/wx/knowledge/list`, data);
};
export const getManufacturerSetting = () => get(`api/wx/dict/manufacturer/list?manufacturerId=${storage.get('manufacturerId')}`, {});
export const getKnowledgeTypeList = (data) => post('api/documentType/query', data)
export const addKnowledgeViewNum = data => post('mp/videoAddNum', data)
export const getManufacturerDeviceSku = params => get(`api/wx/device-sku/list`, params);
export const getMobileOfUser = params => get('api/wx/user/identity', params)
export const companyRegister = data => post('api/wx/company-customer/create', data)
export const getMobileOfUserAndCompanyInfo = params => get('api/wx/user/company-user-info', params)
export const searchCompanyList = params => get('api/wx/company-customer/search', params)
export const finishOrder = data => post('api/wx/work-order/service-complete', data)
export const saveDebugOrder = data => post('api/wx/work-order/debug/manufacturer/save', data)
export const getDebugOrderList = data => post('api/wx/work-order/debug/list', data)
export const getManufacturerDebugListHeader = (data) => get('/api/wx/work-order/debug/list-header', data, { loading: false });
export const assignDebugOrder = data => post('api/wx/work-order/debug/assign', data)
export const acceptDebugOrder = data => post('api/wx/work-order/debug/accept', data)
export const applyReassignDebugOrder = data => post('api/wx/work-order/debug/apply-reassign', data)
export const handleDebugReassignApply = data => post('api/wx/work-order/debug/reassign-review', data)
export const cancelDebugOrder = data => post('api/wx/work-order/debug/cancel', data)
export const getDebugOrderDetail = (params) => get('api/wx/work-order/debug/detail', params);
export const getDebugContactUserList = () => get('api/wx/work-order/debug/contact-user-list', {})
export const addDebugOrderLog = (data) => post('api/wx/work-order/debug/process-complete', data)
export const saveDebugOrderLog = (data) => post('api/wx/work-order/debug/process-data-save', data)
export const getDebugServiceLogList = param => get('api/wx/work-order/debug/test-record-list', param)
export const passDebugOrderLog = (data) => post('api/wx/work-order/debug/review-pass', data)
export const rejectDebugOrderLog = (data) => post('api/wx/work-order/debug/review-reject', data)
export const createTrialOrder = (data) => post('api/wx/work-order/trial/manufacturer/save', data)
export const customerCreateTrialOrder = data => post('api/wx/work-order/trial/company/save', data)
export const getTrialOrderDetail = (params) => get('api/wx/work-order/trial/detail', params);
export const getTrialOrderListHeader = (data) => get('api/wx/work-order/trial/list-header', data, { loading: false });
export const getTrialOrderList = data => post('api/wx/work-order/trial/list', data)
export const trialOrderAssign = data => post('api/wx/work-order/trial/assign', data)
export const trialOrderAccept = data => post('api/wx/work-order/trial/accept', data)
export const trialOrderApplyReassign = data => post('api/wx/work-order/trial/apply-reassign', data)
export const trialOrderCancel = data => post('api/wx/work-order/trial/cancel', data)
export const trialOrderImprove = data => post('api/wx/work-order/trial/supplement-device', data)
export const handleTrialReassignApply = data => post('api/wx/work-order/trial/reassign-review', data)
export const submitTrialOrderProductRecord = data => post('api/wx/work-order/trial/product-record', data)
export const saveTrialOrderProductRecord = data => post('api/wx/work-order/trial/product-record-temp', data)
export const getTrialOrderProductRecord = param => get('api/wx/work-order/trial/product-record-temp', param)
export const getTrialWorkpieceStandard = param => get('api/wx/work-order/trial/standard-template', param)
export const passTrialOrderProductRecord = data => post('api/wx/work-order/trial/review-pass', data)
export const rejectTrialOrderProductRecord = data => post('api/wx/work-order/trial/review-reject', data)
export const getTrialOrderLogisticsPendingShippingCount = () => get('api/wx/work-order/trial/logistics/pending-shipping-count', {})
export const getTrialOrderLogisticsPendingShipping = () => get('api/wx/work-order/trial/logistics/pending-shipping', {})
export const addTrialOrderLogistics = data => post('api/wx/work-order/trial/logistics/logistics-add', data)
export const getUserByUserType = data => post('api/wx/user/query-role-type', data)
export const getTrialOrderCompanyList = data => post('api/wx/work-order/trial/company-order-list', data)
export const getTrialOrderProductRecordRead = data => post('api/wx/work-order/trial/product-record-read', data)
export const getOcrDebug = data => post('api/wx/ocr/debug', data)
export const prepareMaterialList = params => get('api/wx/install/prepared/list', params)
export const manufacturerCreateInstallOrder = data => post('api/wx/work-order/install/manufacturer/save', data)
export const customerCreateInstallOrder = data => post('api/wx/work-order/install/company/save', data)
export const getInstallOrderListHeader = (data) => get('api/wx/work-order/install/list-header', data, { loading: false });
export const getInstallOrderList = data => post('api/wx/work-order/install/list', data)
export const getInstallOrderCompanyList = data => post('api/wx/work-order/install/company-order-list', data)
export const getInstallOrderDetail = data => get('api/wx/work-order/install/detail', data)
export const assignInstallOrder = data => post('api/wx/work-order/install/assign', data)
export const applyAddInstallOrder = data => post('api/wx/work-order/apply-add-process-user', data)
export const acceptInstallOrder = data => post('api/wx/work-order/install/accept', data)
export const cancelInstallOrder = data => post('api/wx/work-order/install/cancel', data)
export const applyReassignInstallOrder = data => post('api/wx/work-order/install/apply-reassign', data)
export const auditInstallOrder = data => post('api/wx/work-order/install/review', data)
export const clockInInstallOrder = data => post('api/wx/work-order/clock-in', data, { loading: false })
export const getAttendanceList = data => get('api/wx/work-order/attendance-list', data)
export const saveInstallOrderProcessData = data => post('api/wx/work-order/install/process-data-save', data)
export const sendSignNotice = data => post('api/wx/work-order/feedback/send-sign-notice', data)
export const getDeviceInfoByQRCode = data => get('api/wx/device-qr-code/get-device-info', data)
export const updateBindDevice = data => post('api/wx/device-qr-code/manufacturer-bind', data)
export const companyBindDevice = data => post('api/wx/device-qr-code/company-bind', data)
export const myVideoDraftList = data => post('myVideoDraft/list', data)
export const myVideoList = data => get('api/knowLedgeDocumentVO/myVideo', data)
export const sendAiMessage = data => post('api/wx/im/message/ai', data, { loading: false })
export const getAiMessageList = data => post('mp/talk/list', data)
export const getUserListByPermCode = code => get('api/wx/user/query-permit-code', { code });
export const getManufacturerSystemConfig = (params) => get('api/wx/manufacture/config', params)
export const getNecessaryClockIn = (params) => get('api/wx/work-order/clock-in/necessary', params)
export const wxLogin = data => post('api/wx/login', data)
export const wxCodeToMobile = (code) => get(`api/wx/login/wx-code-mobile?code=${code}`, {})
export const saveProcessRemark = (params) => post('api/wx/work-order/process-remark', params)
export const switchAccount = data => post('api/wx/company/switch', data)
export const saveCompanyUserInfo = (params) => post('api/wx/user/company-user-info', params)
export const searchManufacturer = (params) => get('api/wx/manufacture/search', params)
export const userLogoff = (params) => post('api/wx/user/logout-organization', params)
export const getDeptById = (deptId) => get(`api/dept/getById/${deptId}`, {})
export const updateUserBaseInfo = (params) => post('api/user/update/baseInfo', params)
export const updateUserAvatar = (params) => post('api/user/updateAvatar', params)
export const changeProcessUser = (params) => post('api/wx/work-order/change-process-user', params)
export const getOrderTodoList = () => post('api/wx/work-order/processing-list', {})
export const addInstallProcessUser = (params) => post('api/wx/work-order/add-process-user', params)
export const getInstallPreparedListByDeviceCategory = (params) => post('api/wx/install/prepared/list-by-device-category', params)
export const addApplyService = (params) => post('mp/addApplyService', params)
export const generateVideoCover = (params) => put('api/wx/oss/generateVideoCover', params)
export const getRecommendVideo = (params) => post('mp/recommendVideo', params)
export const getKnowledgeById = (id) => get(`api/knowLedgeDocument/getSimpleById/${id}`, {})
export const updateTalkRecord = (params) => post('api/talk/update', params)
export const getVideo = (params) => post(`mp/video/get`, params)